<template>
	<view class="content">
		<view class="menu-block list-item" @click="navigate(index)" v-for="(item,index) in article" :key="item.id">
				<view class="cover">
					<image class="cover1" :src="item.faceUrl"></image>
				</view>
				<view class="article-info">
					<view class="title">
						<view class="name">
							姓&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;名：
						</view>
						<span style="color: #000;">{{item.name}}</span></view>
					<view class="abstract">
						<view class="name">
							专业方向：
						</view>
						<span style="color: #000;">{{item.major}}</span></view>
					<view class="time">
						<view class="name">
							辅导次数：
						</view>
						<span style="color: #000;">{{item.counsellingCount}}次</span></view>
				</view>
		</view>
	</view>
</template>

<script>
	import {
		getMentorInfoListApi
	} from '@/api/teacher.js';
	import {
		addModuleCount
	} from '@/api/policy.js';
	export default {
		data() {
			return {
				id: 0,
				page: 1,
				limit: 11,
				article: [],
			}
		},
		methods: {
			getAddModuleCount() {
				addModuleCount({
					type: 5,
				}).then(data => {
					uni.hideLoading()
					this.form = data
				}).catch(() => {
					uni.hideLoading()
				})
			},
			navigate1(url) {
				uni.navigateTo({
					url
				})
			},
			navigate(index) {
				const item = this.article[index];
				uni.navigateTo({
					url: `/page_other/teacher/teacherDetail?id=${item.id}&title=${item.title}&time=${item.time}`
				})
			},
			getList() {
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				getMentorInfoListApi({
					page: this.page,
					limit: this.limit,
				}).then(data => {
					uni.hideLoading()
					this.article = data.list
				}).catch(() => {
					uni.hideLoading()
				})
			},
		},
		onLoad() {
			this.getList();
			this.getAddModuleCount()
		}
		
		
		
		// onShareAppMessage: function(res) {
		// 	return {
		// 		title: '"码"上就业',
		// 		path: '/pages/index/index'
		// 	}
		// },
		// watch: { //监听
		// 	tabActive: {
		// 		handler(val) {
		// 			if (val < 3) {
		// 				let type = (val == 1) ? 2166 : 2165
		// 				// this.getList(type);
		// 			}
		// 		},
		// 		//immediate:true,//深度监听
		// 	},
		// },
		
	}
</script>

<style scoped lang="scss">
	.menu-block {
		display: flex;
		width: 92%;
		margin: 30rpx auto;
		background: #fff;
		border-radius: 12px;
		padding: 30rpx;
	}
		.list-item {
			display: flex;
			padding-bottom: 30rpx;
			border-bottom: 1px solid #efefef;
			margin-top: 30rpx;
	
			.cover {
				width: 170rpx;
				height: 200rpx;
				border-radius: 20rpx;
				margin: auto 20rpx auto 0;
				.cover1{
					width: 100%;
					height: 100%;
					border-radius: 20rpx;
				}
			}
	
			.article-info {
				width: calc(100% - 170rpx);
				display: flex;
				flex-direction: column;
				justify-content: space-around;
				margin: 20rpx 0;
	
				.title {
					display: flex;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					font-size: 28rpx;
					color: #999;
				}
	
				.abstract {
					display: flex;
					font-size: 28rpx;
					color: #999;
					overflow: hidden;
					text-overflow: ellipsis;
					white-space: nowrap;
					margin-top: 20rpx;
				}
	
				.time {
					display: flex;
					margin-top: 20rpx;
					font-size: 28rpx;
					color: #999;
				}
			}
		}
	
		// .list-item:last-child {
		// 	border-bottom: none;
		// 	padding-bottom: 0;
		// }
</style>